﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Utils.Extention;
#region Version Info
/* ========================================================================
* 【本页面功能概述】
*
* 作者：wangjianfeng 创建时间：2012/9/22 18:13:01
* 文件名：List.cs
*
* 修改者： 时间：
* 修改说明：
* ========================================================================
*/
#endregion
namespace ChinaLeg.Web.list
{
    public partial class List : System.Web.UI.Page
    {
        protected string title, description, keyWrods, bgImage, adScroll;

        protected int catid;
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Request.QueryString["id"].ToTrim().IsNullOrEmpty())
            {
                catid = Request.QueryString["id"].ToInt32();
                if (!this.IsPostBack)
                {
                    ChinaLeg.Cache.Category.Instance.GetModel(catid, out title, out  keyWrods, out  description, out  bgImage);
                    
                    Top1.BgImage = bgImage;
                    //adScroll = ChinaLeg.Cache.ScrollFocusPicture.Instance.GetList(catid);

                    int parentid = ChinaLeg.Cache.Category.Instance.GetParentId(catid);
                    Top1.CatId = parentid;
                    hlCatParent.Text = hlCatParent1.Text = ChinaLeg.Cache.Category.Instance.GetCatName(parentid);
                    hlCatParent.NavigateUrl = hlCatParent1.NavigateUrl = ChinaLeg.Web.Lib.WebLinks.GetCatLinks(parentid);

                    hlCat.Text = hlCat1.Text = ChinaLeg.Cache.Category.Instance.GetCatName(catid);
                    hlCat.NavigateUrl = hlCat1.NavigateUrl = ChinaLeg.Web.Lib.WebLinks.GetListLinks(catid);


                    int pageSize = 10;
                    int pageIndex = 1;
                    if (!Request.QueryString["page"].ToTrim().IsNullOrEmpty())
                    {
                        pageIndex = Request.QueryString["page"].ToInt32();
                    }

                    int recordCount;
                    rptList.DataSource = ChinaLeg.BLL.News.Instance.GetList(" and catid="+catid, pageSize, pageIndex, out recordCount);
                    rptList.DataBind();

                    divPager.InnerHtml = Utils.Common.Pager.GetPager(recordCount, pageSize, pageIndex, string.Format("list{0}.html?",catid));

                }

            }
        }
    }
}